﻿using FreeSql.DataAnnotations;
using orm.freesql.api.Interface;

namespace orm.freesql.api.Entities
{
    /// <summary>
    /// 订单实体类
    /// </summary>
    public class Order : ISoftDelete
    {
        [Column(IsPrimary = true, IsIdentity = true)]
        public int Id { get; set; }

        public string Number { get; set; } = null!;

        public decimal TotalPrice { get; set; }

        public DateTime CreateTime { get; set; }

        public bool IsDeleted { get; set; }

        [Navigate(nameof(OrderDetail.OrderId))]
        public List<OrderDetail> OrderDetails { get; set; }
    }

    /// <summary>
    /// 订单明细实体类
    /// </summary>
    public class OrderDetail
    {
        [Column(IsPrimary = true, IsIdentity = true)]
        public int Id { get; set; }

        public int OrderId { get; set; }

        public string ProductName { get; set; } = null!;

        public decimal ProductPrice { get; set; }

        public DateTime CreateTime { get; set; }
    }
}
